翻訳と辞書
Words near each other
・ Stacy Martin
・ Stacy May-Johnson
・ Stacy McGaugh
・ Stacy McGee
・ Stacy Mitchhart
・ Stacy Morze
・ Stacy Offenberger
・ Stacy Offner
・ Stack v Dowden
・ Stack v. Boyle
・ Stack Waddy
・ Stack Waddy (album)
・ Stack's Mountains
・ Stack-based memory allocation
・ Stack-O-Tracks
Stack-oriented programming language
・ Stack-sortable permutation
・ Stack-Up
・ Stackable switch
・ Stackdriver
・ Stacked
・ Stacked (film)
・ Stacked Actors
・ Stacked Deck
・ Stacked polytope
・ Stacked Rubbish
・ Stacked Up
・ Stacked Volumetric Optical Disk
・ Stacked with Daniel Negreanu
・ Stackelberg


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Stack-oriented programming language : ウィキペディア英語版
Stack-oriented programming language

A stack-oriented programming language is one that relies on a stack machine model for passing parameters. Several programming languages fit this description, notably Forth, RPL, PostScript, BibTeX style design language〔Oren Patashnik. Designing BibTeX styles. http://www.ctan.org/tex-archive/info/biblio/bibtex/contrib/doc/btxhak.pdf.〕 and also many assembly languages (but on a much lower level).
Stack-oriented programming languages operate upon one or more stacks, each of which may serve different purposes. Because of this, programming constructs in other programming languages may need to be modified for use in a stack-oriented programming language. Adding to this, some stack-oriented programming languages operate in Reverse Polish or ''postfix'' notation - that is, the arguments or parameters for some command are stated ''before'' the actual command itself. For example, in RPN, one would say "2, 3, multiply" instead of "multiply, 2, 3" (''prefix'' or Polish notation) or "2 multiply 3" (''infix'' notation).
==Algorithm of computation on stack==

Assume we have a postfix stack-based programming language, like PostScript. To understand how a stack-oriented programming language works, in calculating an expression such as 2 3 mul, we can use a simple thought experiment.
Say you are standing at the end of a conveyor belt (the ''input''), onto which someone has placed (in sequence) plates marked 2, 3, and mul. You can take the plate at the end of the conveyor (2), but you can't see or take further plates from the conveyor until you do something with the plate you've just taken. The only way you can store plates is in a stack, and you can only add or remove a plate on top of the stack, not in the middle. You also have a supply of blank plates (and a marker), and you can discard plates (but this is permanent). Can you perform the calculation?
Yes, you take plate 2 and put it on the stack, then take plate 3 and put it on the stack. Next, you take the mul plate. This is an instruction to you. You will take the top two plates off the stack, multiply their labels (2 and 3), and write the result (6) on a new plate. The two old plates (2 and 3) and the mul plate are then discarded, and the new plate gets put on the stack. With no more plates remaining on the conveyor, the result of the calculation (6) is shown on the plate at the top of the stack.
This is of course a very simple calculation. What if we wanted to calculate something like (2 + 3) × 11 + 1 ? If we first write it into postfix form, that is, 2 3 add 11 mul 1 add,
we can perform the calculation in exactly the same manner and achieve the correct result. The steps of the calculation are shown in the table below. Each column shows an input element (the plate at the end of the conveyor), and the contents of the stack after processing that input.
After processing all the input, we see the stack contains 56, which is the answer.
We can conclude from this the following: a stack-based programming language has only one way of handling data, by taking one piece of data from the top of the stack, known as ''pop''ping, and putting data back on the top of the stack, known as ''push''ing. Any expression that can be written "conventionally" or in another programming language can be written in postfix (or prefix) form and thus be amenable to be interpreted by a stack-oriented programming language.

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Stack-oriented programming language」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.